/**
 * Auto gen via dbpojo-gen.
 */
package com.us.usws.service.cud.impl;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.us.usws.dao.BaseVideoCatDAO;
import com.us.usws.model.flat.base.DOBaseVideoCat;
import com.us.usws.service.cud.BaseVideoCatCUDService;

/**
 * Service RO impl class
 * @author robot
 */
public class BaseVideoCatCUDServiceImpl implements BaseVideoCatCUDService {

	/**
	 * DAO instance
	 */
	private BaseVideoCatDAO dao = new BaseVideoCatDAO();

	/**
	 * Insert one row.
	 */
	@Override
	public String addBaseVideoCat(DOBaseVideoCat baseVideoCat) {
		return dao.insertBaseVideoCat(baseVideoCat);
	}
	
	/**
	 * add video type relate video cat 
	 */
	public void addRelatedVideoCat(List<String> relateCatUid, int videoTypeId) {
		if(relateCatUid != null && relateCatUid.size() > 0) {
			dao.insertRelatedVideoCat(relateCatUid, videoTypeId);
		}
	}

	/**
	 * Update by PK.
	 */
	@Override
	public void updateBaseVideoCat(DOBaseVideoCat baseVideoCat) {
		dao.updateBaseVideoCat(baseVideoCat);
	}

	/**
	 * Delete row by PK.
	 */
	@Override
	public void deleteBaseVideoCat(String uid) {
		dao.deleteBaseVideoCat(uid);
	}

	@Override
	public void deleteBaseVideoCatMore(String uids) {
		if (StringUtils.isNotBlank(uids)) {
			String[] uid = StringUtils.split(uids, ",");
			for (String id : uid) {
				deleteBaseVideoCat(id);
			}
		}
	}
}